package com.asiainfo.kbisheet.components.grid
{
	import flash.display.DisplayObject;
	
	import mx.controls.advancedDataGridClasses.AdvancedDataGridHeaderRenderer;
	
	/**
	 * 可定义颜色的列头呈现器
	 */
	public class KbsAdgHeaderRenderer extends AdvancedDataGridHeaderRenderer
	{
		public var bgcolor:uint;
		
		public function KbsAdgHeaderRenderer()
		{
			super();
		}
		
		override protected function updateDisplayList(unscaledWidth:Number,
													  unscaledHeight:Number):void
		{
			super.updateDisplayList(unscaledWidth, unscaledHeight);
		
			// Set background size, position, color
			if (background)
			{
				background.graphics.clear();
				background.graphics.beginFill(bgcolor, 1.0); // transparent
				background.graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
				background.graphics.endFill();
				setChildIndex( DisplayObject(background), 0 );
			}
		}
	}
}